package com.ego.sender;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitMQSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 相直连交换器中发送信息
     * @param exchange
     * @param routingKey
     * @param msg
     */
    public void sendDirect(String exchange,String routingKey,Object msg) {
        rabbitTemplate.convertAndSend(exchange, routingKey, msg);
    }

}
